package com.hex.ds.code.detection.common.base;

import lombok.Data;

/**
 * @Package com.hex.ds.code.detection.common.base
 * @ClassName Page
 * @Description 分页基础对象
 * @Author gj.xu
 * @Date 2022/11/18 18:36
 * @Version v2.0
 **/
@Data
public class Page {

    private int pageIndex = 0;

    private int pageSize = 0;

    private long total = 0L;

    private String sort;

    public void setPage(int page) {
        this.pageIndex = page;
    }

    public void setSize(int size) {
        this.pageSize = size;
    }

    public void setPageIndex(int pageIndex) {
        if (pageIndex < 0) {
            this.pageIndex = 0;
        } else {
            this.pageIndex = pageIndex;
        }

    }

    public int getOffset() {
        return getPageIndex() * pageSize;
    }

}
